package com.news.xinwen.service;

import com.news.xinwen.mapper.newsMapper;
import com.news.xinwen.model.news;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class userserviceImpl implements userservice {
    @Autowired
    private newsMapper newsMapper;
    @Override
    public news select(String id) {
    news news  = newsMapper.selectByPrimaryKey(id);
        return news;
    }
    public int update(news news) {
        int i  = newsMapper.updateByPrimaryKeySelective(news);
        return i;
    }
    public int add(news news) {
        int i  = newsMapper.insertSelective(news);
        return i;
    }
    public int del(String id) {
        int i  = newsMapper.deleteByPrimaryKey(id);
        return i;
    }
    public List<news> all() {
      List<news> news=newsMapper.select();
        return news;
    }
}
